define(function() {
    return ['$scope', '$timeout','$location','$interval','header', function($scope, $timeout, $location,$interval,header) {
		$scope.animateEnter = true;
		$scope.animateLeave = false;

    	
      //监听顶部显示标示 (顶部显示'1'：显示案源库)
        $scope.$on('flag-tag', function(event,data) {
            $scope.falgTag = data;
        });

        $scope.$on('title-name', function(event,data) {
            $scope.titleName = data;
        });

        //监听特殊返回事件(左侧返回键)
        $scope.manageMenu = function(routeUrl){
        	 if(routeUrl == '/'){
        	 	 // home.toBack(null,function(){},null);
             $location.url("/");
        	 }else if(routeUrl == 'downCity') {
				 $scope.$broadcast("dowmCityList", true);
        	 }else if(routeUrl == 'downDet') {
                 $scope.$broadcast("dowmDetContent", true);
             }else if(routeUrl == 'downCaseType') {
                 $scope.$broadcast("downCaseType", true);
             }else if(routeUrl == 'suitFeePlan') {
                 $scope.$broadcast("dowmsuitFeePlan", true);
             }else{
                $scope.animateEnter = false;
                $scope.animateLeave = true;
                history.back();
             }
        }
        
        //监听特殊返回事件(右侧管理键)
        $scope.manageRightBt = function(rightManage){
        	
        }
        
        function exitApp(){ 
            navigator.app.exitApp(); 
        }


		

        // 页面跳转之前，先修改动画方向
        $scope.$on('goNext', function(event, data) {
			$timeout(function(){
				$scope.animateEnter = true;
				$scope.animateLeave = false;
				$location.url(data);
			},0)
//            $route.reload();刷新当前页面
//          $location.path(data).replace();想改变当前 URL 而不创建新的历史记录的话
        });
        
        $scope.$apply();
    }];
});